package com.rainfull.ui;

import com.rainfull.core.IRUIAPNotify;
import com.rainfull.core.RUserInfo;

import android.app.Activity;
import android.os.Bundle;
import android.view.KeyEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

public class RUIAccountInfo extends Activity  implements OnClickListener
{  
	private main m_mainActive = null;
	   
	@Override
    public void onCreate(Bundle savedInstanceState) 
    {    	
        super.onCreate(savedInstanceState);
        setContentView(R.layout.account_info);
        init();
    }
	public void init()
    {
    	m_mainActive = (main)this.getParent();
    	RUserInfo userInfo = m_mainActive.m_userInfo;
    	TextView textUserName = (TextView) findViewById(R.id.account_info_uname);
    	TextView textScore = (TextView) findViewById(R.id.account_info_score);
    	TextView textExit = (TextView) findViewById(R.id.account_info_exit);
    	textExit.setOnClickListener(this);
    	textUserName.setText(userInfo.getUserName());
    	textScore.setText("积分："+userInfo.getScore());  
    }
	public boolean onKeyDown(int keyCode, KeyEvent event) 
	{
		return false;
	}
	public void onClick(View arg0) 
	{
		//退出账号
		m_mainActive.UserExit();
		m_mainActive.changeTabView(RUIAccountInfo.class, RUIAccount.class);
	} 
	public void onResume()
	{
		super.onPause();
		TextView textUserName = (TextView) findViewById(R.id.account_info_uname);
    	textUserName.setText(m_mainActive.m_userInfo.getUserName());
		int nScore = m_mainActive.m_userInfo.getScore();
		
		TextView textScore = (TextView) findViewById(R.id.account_info_score);
    	textScore.setText("积分："+nScore);
	}
}
